package cn.iocoder.yudao.module.course.dal.mysql.interactive;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.course.dal.dataobject.interactive.InteractiveDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.course.controller.admin.interactive.vo.*;

/**
 * 课程交互 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InteractiveMapper extends BaseMapperX<InteractiveDO> {

    default PageResult<InteractiveDO> selectPage(InteractivePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InteractiveDO>()
                .eqIfPresent(InteractiveDO::getSourceType, reqVO.getSourceType())
                .eqIfPresent(InteractiveDO::getSourceId, reqVO.getSourceId())
                .eqIfPresent(InteractiveDO::getTestType, reqVO.getTestType())
                .eqIfPresent(InteractiveDO::getTestId, reqVO.getTestId())
                .betweenIfPresent(InteractiveDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(InteractiveDO::getToPlayStartTime, reqVO.getToPlayStartTime())
                .eqIfPresent(InteractiveDO::getPassed, reqVO.getPassed())
                .eqIfPresent(InteractiveDO::getVersion, reqVO.getVersion())
                .eqIfPresent(InteractiveDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(InteractiveDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InteractiveDO::getId));
    }

}